import java.util.Scanner;

/**
 * @ProjectName: study3
 * @FileName: Ex3
 * @author:HWJ
 * @Data: 2023/10/12 21:52
 * 1234  1243   1324  1342  1432
 * 2134  2143   2314  2341  2431
 * 3214  3241   3421
 * 4321
 */
public class Main {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        while (input.hasNext()){
            String str1 = input.next();
            String str2 = input.next();
            char[] s1 = str1.toCharArray();
            char a = s1[0];
            int index = 0;
            for (int i = 1; i < s1.length; i++) {
                if (s1[i] > a){
                    a = s1[i];
                    index = i;
                }
            }
            String ans = "";
            for (int i = 0; i <= index; i++) {
                ans += String.valueOf(s1[i]);
            }
            ans += str2;
            for (int i = index + 1; i < s1.length; i++) {
                ans += String.valueOf(s1[i]);
            }
            System.out.println(ans); 
        }
        
    }

}